package com.logistic.common;

import java.util.Random;

public class UidGeneratorByRule { 
    public UidGeneratorByRule() { 
    } 
    /** 
     * 获得一个五位的uid
     * 由5个数字组成
     * @return String UUID 
     */ 
    public static String getUid(){ 
    	String uId;
		Random rd = new Random();
		//uId =  a_z[rd.nextInt(25)]+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9));
		uId =  Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9));
		
		return uId;
    } 
    /** 
     * 获得一个5位的收件标示
     * 由五位大写字母组成
     * @return String wbId 
     */ 
    public static String getUreceiveId(){
    	String uReceiveId;
		char[] A_Z = {'A','B','C','D','E','F','G','H','I','J','K','L','M'
				,'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
		Random rd = new Random();
		uReceiveId =  String.valueOf(A_Z[rd.nextInt(25)])+String.valueOf(A_Z[rd.nextInt(25)])+String.valueOf(A_Z[rd.nextInt(25)])+String.valueOf(A_Z[rd.nextInt(25)])+String.valueOf(A_Z[rd.nextInt(25)]);
		return uReceiveId;
    }
    
    /** 
     * 获得一个9位的订单号
     * 由九位数字组成
     * @return String wbId 
     */ 
    public static String getWaybillId(){ 
    	String wbId;
    	Random rd = new Random();
    	wbId =  Integer.toString(1)+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))
    			+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9))+Integer.toString(rd.nextInt(9));
		
		return wbId;
    } 
}   